<template>
  <t-page-one
      :form-desc="formDesc"
      add-url="/sys/dict/add" update-url="/sys/dict/update"
      url-query-by-id="/sys/dict/query/one/"
      url-delete-by-ids="/sys/dict/deleteByIds"
      url="/sys/dict/query/page">
    <!--  表格右上角按钮  -->
    <template slot="btns">
      <el-button type="primary" icon="el-icon-refresh-left" @click="refreshSysDictCache">刷新缓存</el-button>
    </template>

    <el-link slot="col-action" slot-scope="{row}" type="primary" @click="goToDictItemManage(row)">
      <i class="el-icon-view"></i> 字典项
    </el-link>
  </t-page-one>
</template>

<script>
export default {
  data() {
    return {
      /* 表单 */
      formDesc: {
        dictCode: {
          label: '字典代码',
          type: 'input',
          rules: [
            {required: true, message: '该项必填', trigger: 'blur'},
            {min: 1, max: 20, message: '长度在 1 到 20 个字符', trigger: 'blur'},
            {pattern: /^\w+$/, message: '由数字、字母、下划线组成', trigger: 'blur'},
          ],
          //表格列配置
          colCfg: {
            width: '180'
          }
        },
        dictName: {
          label: '字典名称',
          type: 'input',
          rules: [
            {required: true, message: '该项必填', trigger: 'blur'},
            {min: 1, max: 20, message: '长度在 1 到 20 个字符', trigger: 'blur'},
            {pattern: /^[\u4E00-\u9FA5A-Za-z0-9_]+$/, message: '由中文、数字、字母、下划线组成', trigger: 'blur'},
          ],
          colCfg: {
            width: '180'
          }
        },
        remark: {
          label: '备注',
          type: 'textarea',
          rules: [
            {min: 1, max: 120, message: '长度在 1 到 120 个字符', trigger: 'blur'},
          ],
          colCfg: {
            hidden: false,
          }
        },
        action: {
          label: '操作',
          hidden: true,

          colCfg: {
            hidden: false,
            isSlot: true,
            fixed: "right",
            width: "80"
          }
        }
      },
    }
  },
  methods: {
    goToDictItemManage(row) {
      // console.log(row)
      this.$router.push({path:'dictItemManage',query:{dictId:row.id}})
    }
  }
}
</script>

<style scoped>

</style>